/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.hera.base.domain.BaseDomain;
import com.hera.process.config.domain.Department;

/**
 *
 * @author cmontes
 */
@Entity
public class Swimlane extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SwimlanePK swimlanePK;
    private String description;
    //@OneToMany(mappedBy = "swimlane")
    @Transient
    private List<Stage> stageList;
    @JoinColumn(name = "ID_PROCESS", referencedColumnName = "ID_PROCESS", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Process process;
    @JoinColumn(name = "ID_DEPARTMENT", referencedColumnName = "ID_DEPARTMENT", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Department department;

    public Swimlane() {
    }

    public Swimlane(SwimlanePK swimlanePK) {
        this.swimlanePK = swimlanePK;
    }

    public Swimlane(Long idProcess, Long idDepartment) {
        this.swimlanePK = new SwimlanePK(idProcess, idDepartment);
    }

    public SwimlanePK getSwimlanePK() {
        return swimlanePK;
    }

    public void setSwimlanePK(SwimlanePK swimlanePK) {
        this.swimlanePK = swimlanePK;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Stage> getStageList() {
        return stageList;
    }

    public void setStageList(List<Stage> stageList) {
        this.stageList = stageList;
    }

    public Process getProcess() {
        return process;
    }

    public void setProcess(Process process) {
        this.process = process;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (swimlanePK != null ? swimlanePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof Swimlane)) {
            return false;
        }
        Swimlane other = (Swimlane) object;
        if ((this.swimlanePK == null && other.swimlanePK != null) || (this.swimlanePK != null && !this.swimlanePK.equals(other.swimlanePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.Swimlane[ swimlanePK=" + swimlanePK + " ]";
    }
    
}
